package com.contexticon.mediaTest;



import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaListPlayerComponent;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;

public class vlcPlayer {

        private final EmbeddedMediaPlayerComponent mediaPlayerComponent;
         // private final EmbeddedMediaListPlayerComponent mediaListPlayerComponent;

        
  public static void main(String[] args) {

			System.setProperty("jna.library.path", "/Applications/VLC.app/Contents/MacOS/lib/");

		
	  
    new vlcPlayer().start("/Users/dglodzik/Movies/FrontRoll.flv"); //712testclipNTSC
  }
  
  private vlcPlayer() {
            JFrame frame = new JFrame("vlcj Teste");
            frame.setSize(700, 700);
            mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
            //mediaListPlayerComponent = new EmbeddedMediaListPlayerComponent();
         
            //Canvas canvas=new Canvas();

            mediaPlayerComponent.setSize(500, 500);
            frame.setContentPane(mediaPlayerComponent);
            
            
            //JPanel panel=new JPanel();
            //panel.setSize(500, 300);
            //panel.add(mediaPlayerComponent, BorderLayout.CENTER);
            //panel.add(b, BorderLayout.SOUTH);
            

            //frame.setContentPane(panel);
        
    //final MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
    //final EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();
    //mediaPlayer.setVideoSurface(mediaPlayerFactory.newVideoSurface(canvas));
     

        //    frame.setContentPane(mediaPlayerComponent);
           //frame.setContentPane(mediaListPlayerComponent);

            //frame.setLocation(100, 100);
            
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
         //   frame.pack();

          }
  
  private void start(String mrl) {
            // One line of vlcj code to add the media to the play-list...
            //mediaListPlayerComponent.getMediaList().addMedia(mrl);
            //mediaListPlayerComponent.getMediaList().addMedia("D:\\Documents\\Escola\\Tese\\AVIs\\football.avi");

            // Another line of vlcj code to play the media...
            mediaPlayerComponent.getMediaPlayer().playMedia(mrl);
/*          
            mediaPlayerComponent.getMediaPlayer().playMedia(mrl);
            mediaPlayerComponent.getMediaPlayer().setFullScreen(true);
        */
          }
}